package usj.util;

public class AddressManagement {
	public static String [] troceaEmail(String email) {
		String[] res = email.split("@");
		try {
			if (res != null && res.length != 2) {
				res = null;
			} else if (!((res[0] != null && res[0].length() > 0)
						&& (res[1] != null && res[1].length() > 0))) {
				res = null;
			}
		} catch (Exception e) {
			res = null;
		}
		
		return res;
	}

	public static boolean validaDominio(String email, String nuestroDominio) {
		boolean res = false;
		String[] trozos = troceaEmail(email);
		res = trozos[1].equals(nuestroDominio);
		return res;
	}
}
